package com.study.ordercenter.service;

import com.study.ordercenter.entity.OrderEntity;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class OrderService {

    private static final Map<Integer, OrderEntity> ORDER_LIST = new HashMap<>();

    static {
        ORDER_LIST.put(1, new OrderEntity(1, "1111", "电脑", "办公用品"));
        ORDER_LIST.put(2, new OrderEntity(2, "2222", "手机", "电子用品"));
    }

    public OrderEntity orderInfo(Integer id) {
        OrderEntity orderInfo = ORDER_LIST.get(id);
        return orderInfo;
    }

    public List<OrderEntity> orderList() {
        ArrayList<OrderEntity> orderList = new ArrayList<>(ORDER_LIST.values());
        return orderList;
    }
}
